package com.jzo2o.customer.controller.agency;

import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.jzo2o.customer.service.impl.BankAccountServiceImpl.SERVICE_AGENCY_TYPE;



@RestController
@RequestMapping("/agency/bank-account")
public class AgencyBankAccountController {
    @Resource
    private IBankAccountService bankAccountService;

    @PostMapping
    @ApiOperation("添加或更新银行卡信息")
    public void addOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO) {
        bankAccountUpsertReqDTO.setType(SERVICE_AGENCY_TYPE);
        bankAccountService.saveOrUpdateBankAccount(bankAccountUpsertReqDTO);
    }
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行卡信息")
    public BankAccountResDTO getCurrentUserBankAccount() {
        return bankAccountService.getCurrentUserBankAccount();
    }
}
